﻿<Window x:Class="MSUS.Kinect.PowerPointController.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
		xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
		xmlns:vm="clr-namespace:MSUS.Kinect.PowerPointController.ViewModels"
        xmlns:converters="clr-namespace:MSUS.Kinect.PowerPointController.Converters"
        d:DataContext="{d:DesignInstance IsDesignTimeCreatable=True, Type=vm:DesignTimeViewModel}"
		mc:Ignorable="d"

        Title="MainWindow" Width="1024" Height="768" Loaded="Window_Loaded" Closing="Window_Closing" KeyDown="Window_KeyDown" WindowState="Maximized">
    <Window.Resources>
        <converters:BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter"/>
        <converters:BooleanToVisibilityConverterInverse x:Key="BooleanToVisibilityConverterInverse"/>
    </Window.Resources>
    <Window.DataContext>
		<vm:MainViewModel />
	</Window.DataContext>
	<Canvas Name="MainCanvas">
		<!-- this lists all of the loaded canvas files. -->
		<StackPanel Canvas.Right="0" Canvas.Top="0">
			<ListBox Name="LoadedGestures" ItemsSource="{Binding LoadedGestures}">
			</ListBox>
		</StackPanel>

		<StackPanel  Canvas.Left="0" Canvas.Top="0" >
			<CheckBox Name="checkBox1" IsChecked="{Binding EnableMouseTracking, Mode=TwoWay}">
				<TextBlock Text="Enable Mouse Tracking" Foreground="Black" FontSize="20" Grid.Row="0" TextAlignment="Center"/>
			</CheckBox>
			<TextBlock Text="No skeleton tracked" Visibility="{Binding NoSkeletonTrackedWarning, Converter={StaticResource BooleanToVisibilityConverter}}" Name="NoSkeletonTrackedWarning" Foreground="Red" FontSize="20"/>
			<TextBlock Visibility="{Binding HandOnLeftHip, Converter={StaticResource BooleanToVisibilityConverter}}" Text="Mouse Down" Foreground="Black" FontSize="20" />
			<TextBlock Visibility="{Binding MouseTrackingActive, Converter={StaticResource BooleanToVisibilityConverter}}" Text="Mouse Tracking Active" Foreground="Black" FontSize="20" />
		</StackPanel>
		
		<!-- flag onscreen if the skeleton isn't currently tracked.-->
		
		<!-- notes about the currently tracked Joint, and the number of Gestures observed -->
		<Grid  Canvas.Right="0" Canvas.Bottom="0">
			<Grid.RowDefinitions>
				<RowDefinition></RowDefinition>
				<RowDefinition></RowDefinition>
				<RowDefinition></RowDefinition>
			</Grid.RowDefinitions>
			<TextBlock Text="{Binding CurrentTrackedJointName}" Name="CurrentlyTrackingJoint" Foreground="Black" FontSize="20" Grid.Row="1" TextAlignment="Center"/>
			<TextBlock Text="{Binding GestureCounter}" Name="GestureCount" Foreground="Red" FontSize="40" Grid.Row="2" TextAlignment="Center"/>
		</Grid>

		<!-- What was the last observed gesture.-->
		<TextBlock Canvas.Left="0" Canvas.Bottom="0" Name="LastGesture" Text="{Binding LastGesture}" Foreground="Black" FontSize="30"/>

		<Image Canvas.Left="0" Canvas.Bottom="30" Name="FullTrackingImage" Width="320" Height="240"/>
		<Image Canvas.Right="50" Canvas.Bottom="30" Name="HandTrackingImage" Width="200" Height="200"/>

		<!-- gesture displays -->
		<!-- add a line named "[GestureName]JointLine0" to render the gesture -->
		<Line Name="LastSavedJointLine0" X1="0" X2="0" Y1="0" Y2="0" Stroke="Blue" StrokeThickness="4"/>


		<!-- these are reference lines for getting Stroke/StrokeThickness info.  they are the start of the history trails for each joint-->
		<Line Name="HandRightJointLine0" X1="280" X2="280" Y1="290" Y2="290" Stroke="SlateGray" StrokeThickness="3"/>
		<Line Name="HandLeftJointLine0" X1="120" X2="120" Y1="290" Y2="290" Stroke="SpringGreen" StrokeThickness="3"/>
		<Line Name="HeadJointLine0" X1="200" X2="200" Y1="150" Y2="150" Stroke="Orange" StrokeThickness="3"/>
		<Line Name="ElbowLeftJointLine0" X1="125" X2="125" Y1="225" Y2="225" Stroke="SlateGray" StrokeThickness="3"/>
		<Line Name="ElbowRightJointLine0" X1="275" X2="275" Y1="225" Y2="225" Stroke="SpringGreen" StrokeThickness="3"/>
		<Line Name="WristLeftJointLine0" X1="125" X2="125" Y1="275" Y2="275" Stroke="SlateGray" StrokeThickness="3"/>
		<Line Name="WristRightJointLine0" X1="275" X2="275" Y1="275" Y2="275" Stroke="SpringGreen" StrokeThickness="3"/>
		<Line Name="ShoulderLeftJointLine0" X1="150" X2="150" Y1="175" Y2="175" Stroke="Blue" StrokeThickness="3"/>
		<Line Name="ShoulderRightJointLine0" X1="250" X2="250" Y1="175" Y2="175" Stroke="Blue" StrokeThickness="3"/>
		<Line Name="ShoulderCenterJointLine0" X1="200" X2="200" Y1="175" Y2="175" Stroke="Blue" StrokeThickness="3"/>
		<Line Name="SpineJointLine0" X1="200" X2="200" Y1="225" Y2="225" Stroke="Blue" StrokeThickness="3"/>
		<Line Name="HipCenterJointLine0" X1="200" X2="200" Y1="275" Y2="275" Stroke="Blue" StrokeThickness="3"/>
		<Line Name="HipLeftJointLine0" X1="175" X2="175" Y1="275" Y2="275" Stroke="Blue" StrokeThickness="3"/>
		<Line Name="HipRightJointLine0" X1="225" X2="225" Y1="275" Y2="275" Stroke="Blue" StrokeThickness="3"/>
		<Line Name="KneeLeftJointLine0" X1="150" X2="150" Y1="350" Y2="350" Stroke="Blue" StrokeThickness="3"/>
		<Line Name="KneeRightJointLine0" X1="250" X2="250" Y1="350" Y2="350" Stroke="Blue" StrokeThickness="3"/>
		<Line Name="AnkleLeftJointLine0" X1="150" X2="150" Y1="400" Y2="400" Stroke="Blue" StrokeThickness="3"/>
		<Line Name="AnkleRightJointLine0" X1="250" X2="250" Y1="400" Y2="400" Stroke="Blue" StrokeThickness="3"/>
		<Line Name="FootLeftJointLine0" X1="125" X2="125" Y1="400" Y2="400" Stroke="Blue" StrokeThickness="3"/>
		<Line Name="FootRightJointLine0" X1="275" X2="275" Y1="400" Y2="400" Stroke="Blue" StrokeThickness="3"/>


		<!-- Actual Skeleton Lines-->
		<!-- these reference the gesture lines above, so they don't need to be set twice -->
		<Line Name="HeadToNeck" Stroke="Black" StrokeThickness="6"
			  X1="{Binding X1, ElementName=HeadJointLine0}" 
			  Y1="{Binding Y1, ElementName=HeadJointLine0}" 
			  X2="{Binding X1, ElementName=ShoulderCenterJointLine0}" 
			  Y2="{Binding Y1, ElementName=ShoulderCenterJointLine0}"/>
		<Line Name="ShoulderLeft" Stroke="Black" StrokeThickness="6"
			  X1="{Binding X1, ElementName=ShoulderLeftJointLine0}" 
			  Y1="{Binding Y1, ElementName=ShoulderLeftJointLine0}" 
			  X2="{Binding X1, ElementName=ShoulderCenterJointLine0}" 
			  Y2="{Binding Y1, ElementName=ShoulderCenterJointLine0}"/>
		<Line Name="ShoulderRight" Stroke="Black" StrokeThickness="6"
			  X1="{Binding X1, ElementName=ShoulderRightJointLine0}" 
			  Y1="{Binding Y1, ElementName=ShoulderRightJointLine0}" 
			  X2="{Binding X1, ElementName=ShoulderCenterJointLine0}" 
			  Y2="{Binding Y1, ElementName=ShoulderCenterJointLine0}"/>
		<Line Name="ArmUpperLeft" Stroke="Black" StrokeThickness="6"
			  X1="{Binding X1, ElementName=ShoulderLeftJointLine0}" 
			  Y1="{Binding Y1, ElementName=ShoulderLeftJointLine0}" 
			  X2="{Binding X1, ElementName=ElbowLeftJointLine0}" 
			  Y2="{Binding Y1, ElementName=ElbowLeftJointLine0}"/>
		<Line Name="ArmUpperRight" Stroke="Black" StrokeThickness="6"
			  X1="{Binding X1, ElementName=ShoulderRightJointLine0}" 
			  Y1="{Binding Y1, ElementName=ShoulderRightJointLine0}" 
			  X2="{Binding X1, ElementName=ElbowRightJointLine0}" 
			  Y2="{Binding Y1, ElementName=ElbowRightJointLine0}"/>
		<Line Name="ArmLowerLeft" Stroke="Black" StrokeThickness="6"
			  X1="{Binding X1, ElementName=WristLeftJointLine0}" 
			  Y1="{Binding Y1, ElementName=WristLeftJointLine0}" 
			  X2="{Binding X1, ElementName=ElbowLeftJointLine0}" 
			  Y2="{Binding Y1, ElementName=ElbowLeftJointLine0}"/>
		<Line Name="ArmLowerRight" Stroke="Black" StrokeThickness="6"
			  X1="{Binding X1, ElementName=WristRightJointLine0}" 
			  Y1="{Binding Y1, ElementName=WristRightJointLine0}" 
			  X2="{Binding X1, ElementName=ElbowRightJointLine0}" 
			  Y2="{Binding Y1, ElementName=ElbowRightJointLine0}"/>
		<Line Name="HandLeft" Stroke="Black" StrokeThickness="6"
			  X1="{Binding X1, ElementName=WristLeftJointLine0}" 
			  Y1="{Binding Y1, ElementName=WristLeftJointLine0}" 
			  X2="{Binding X1, ElementName=HandLeftJointLine0}" 
			  Y2="{Binding Y1, ElementName=HandLeftJointLine0}"/>
		<Line Name="HandRight" Stroke="Black" StrokeThickness="6"
			  X1="{Binding X1, ElementName=WristRightJointLine0}" 
			  Y1="{Binding Y1, ElementName=WristRightJointLine0}" 
			  X2="{Binding X1, ElementName=HandRightJointLine0}" 
			  Y2="{Binding Y1, ElementName=HandRightJointLine0}"/>
		<Line Name="SpineUpper" Stroke="Black" StrokeThickness="6"
			  X1="{Binding X1, ElementName=ShoulderCenterJointLine0}" 
			  Y1="{Binding Y1, ElementName=ShoulderCenterJointLine0}" 
			  X2="{Binding X1, ElementName=SpineJointLine0}" 
			  Y2="{Binding Y1, ElementName=SpineJointLine0}"/>
		<Line Name="SpineLower" Stroke="Black" StrokeThickness="6"
			  X1="{Binding X1, ElementName=HipCenterJointLine0}" 
			  Y1="{Binding Y1, ElementName=HipCenterJointLine0}" 
			  X2="{Binding X1, ElementName=SpineJointLine0}" 
			  Y2="{Binding Y1, ElementName=SpineJointLine0}"/>
		<Line Name="HipLeft" Stroke="Black" StrokeThickness="6"
			  X1="{Binding X1, ElementName=HipLeftJointLine0}" 
			  Y1="{Binding Y1, ElementName=HipLeftJointLine0}" 
			  X2="{Binding X1, ElementName=HipCenterJointLine0}" 
			  Y2="{Binding Y1, ElementName=HipCenterJointLine0}"/>
		<Line Name="HipRight" Stroke="Black" StrokeThickness="6"
			  X1="{Binding X1, ElementName=HipRightJointLine0}" 
			  Y1="{Binding Y1, ElementName=HipRightJointLine0}" 
			  X2="{Binding X1, ElementName=HipCenterJointLine0}" 
			  Y2="{Binding Y1, ElementName=HipCenterJointLine0}"/>
		<Line Name="LegUpperLeft" Stroke="Black" StrokeThickness="6"
			  X1="{Binding X1, ElementName=HipLeftJointLine0}" 
			  Y1="{Binding Y1, ElementName=HipLeftJointLine0}" 
			  X2="{Binding X1, ElementName=KneeLeftJointLine0}" 
			  Y2="{Binding Y1, ElementName=KneeLeftJointLine0}"/>
		<Line Name="LegUpperRight" Stroke="Black" StrokeThickness="6"
			  X1="{Binding X1, ElementName=HipRightJointLine0}" 
			  Y1="{Binding Y1, ElementName=HipRightJointLine0}" 
			  X2="{Binding X1, ElementName=KneeRightJointLine0}" 
			  Y2="{Binding Y1, ElementName=KneeRightJointLine0}"/>
		<Line Name="LegLowerLeft" Stroke="Black" StrokeThickness="6"
			  X1="{Binding X1, ElementName=AnkleLeftJointLine0}" 
			  Y1="{Binding Y1, ElementName=AnkleLeftJointLine0}" 
			  X2="{Binding X1, ElementName=KneeLeftJointLine0}" 
			  Y2="{Binding Y1, ElementName=KneeLeftJointLine0}"/>
		<Line Name="LegLowerRight" Stroke="Black" StrokeThickness="6"
			  X1="{Binding X1, ElementName=AnkleRightJointLine0}" 
			  Y1="{Binding Y1, ElementName=AnkleRightJointLine0}" 
			  X2="{Binding X1, ElementName=KneeRightJointLine0}" 
			  Y2="{Binding Y1, ElementName=KneeRightJointLine0}"/>
		<Line Name="FootLeft" Stroke="Black" StrokeThickness="6"
			  X1="{Binding X1, ElementName=AnkleLeftJointLine0}" 
			  Y1="{Binding Y1, ElementName=AnkleLeftJointLine0}" 
			  X2="{Binding X1, ElementName=FootLeftJointLine0}" 
			  Y2="{Binding Y1, ElementName=FootLeftJointLine0}"/>
		<Line Name="FootRight" Stroke="Black" StrokeThickness="6"
			  X1="{Binding X1, ElementName=AnkleRightJointLine0}" 
			  Y1="{Binding Y1, ElementName=AnkleRightJointLine0}" 
			  X2="{Binding X1, ElementName=FootRightJointLine0}" 
			  Y2="{Binding Y1, ElementName=FootRightJointLine0}"/>
		<Canvas Name="HeadEllipseBox" Canvas.Left="{Binding X1, ElementName=HeadJointLine0}" Canvas.Top="{Binding Y1, ElementName=HeadJointLine0}" >
			<Ellipse Canvas.Left="-50" 
				 Canvas.Top="-50" 
				 Width="100" Height="100" Stroke="Black" StrokeThickness="6" Fill="Gray" />
		</Canvas>

	</Canvas>
</Window>
